package com.tff.gmall.config;

import com.tff.gmall.interceptors.AuthInterceptors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @author Fafa Tuo
 * @version 1.0
 * @date 2021/7/9 16:40
 */
@Configuration
public class WebMvcConfiguration extends WebMvcConfigurerAdapter {

    @Autowired
    private AuthInterceptors authInterceptors;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //分开写不行
        registry.addInterceptor(authInterceptors).addPathPatterns("/**").excludePathPatterns("/error");
        //registry.addInterceptor(authInterceptors).excludePathPatterns("/error");
        super.addInterceptors(registry);
    }
}
